<div class="form"><?php

$prevSection = null;

echo $open_tag;

foreach ($inputs as $key => $config) {
	
	if ($prevSection != $config['section']) {
		if ($prevSection) { ?></fieldset><?php }
		$prevSection = $config['section'];
		?><fieldset><?php
		if ($config['section_title']) { ?><legend><?php echo $config['section_title']; ?></legend><? }
		if ($config['section_comment']) { ?><p class="comment"><?php echo $config['section_comment']; ?></p><? }
	}
		
	?><div class="item<?php
	if (!empty($config['required'])) { echo ' required'; }
	if (!empty($config['error'])) { echo ' error'; }
	?>"><?php
	if (!empty($config['label'])) { ?><div class="label"><?php echo $config['label']; ?></div><?php }
	?><div class="input"><?php echo $config['input']; ?></div><?php
	if (!empty($config['error'])) { ?><div class="errorbox"><?php echo $config['error']; ?></div><?php }
	if (!empty($config['tip'])) { ?><div class="tip"><?php echo $config['tip']; ?> </div> <?php } ?>
	</div><?php
} 
?><div class="controls"><?php 

foreach ($controls as $key => $control) {
	$this->load->view('configuration_' . $name . '_' . $key, array('control' => $control));
}

?></div><?php 
echo $close_tag; 
?></div>
